﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Combat/Combat.master" AutoEventWireup="true"
    CodeFile="DeviceNew.aspx.cs" Inherits="MapInfo_ProfessionalTeam_DeviceNew" StylesheetTheme="Content" %>

<%@ Register Src="../../UserContral/ListPageContral.ascx" TagName="ListPageContral"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script type="text/javascript">
        function print() {
            window.open('Print.aspx');

        }
        function CheckAll(oCheckbox) {
            var items = document.getElementsByTagName("INPUT");
            for (i = 0; i < items.length; i++) {
                if (items[i].type == "checkbox") {
                    items[i].checked = oCheckbox.checked;
                }
            }
        }
        function OpenWin(url) {
            var h = 480;
            var w = 640;
            var t = (screen.height - h) / 2;
            var l = (screen.width - w) / 2;
            window.open(url, null, 'left=' + l + ",top=" + t + ",width=" + w + ",height=" + h + ",toolbar=yes,scrollbars=yes,status=yes");
        }
    </script>

    <asp:UpdatePanel runat="server" ID="upl">
        <Triggers>
            <asp:PostBackTrigger ControlID="Button1" />
        </Triggers>
        <ContentTemplate>
            <table style="width: 100%;" cellpadding="0" cellspacing="0" class="intable">
                <caption>
                    <span>编辑器材[<asp:LinkButton ID="lblReturn" runat="server" OnClick="lblReturn_Click"
                        ValidationGroup="0">返回</asp:LinkButton>]</span>
                </caption>
                <tr>
                    <td style="width: 10%">
                        类别：
                    </td>
                    <td>
                        <asp:DropDownList ID="DeviceClassList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DeviceClassList_SelectedIndexChanged">
                        </asp:DropDownList>
                        <span class="comment">根据类别和装备状态筛选装备器材</span>
                    </td>
                </tr>
                <tr>
                    <td>
                        装备状态：
                    </td>
                    <td>
                        <asp:RadioButtonList ID="rblState" runat="server" DataTextField="ItemName" DataValueField="ItemID"
                            AutoPostBack="True" OnSelectedIndexChanged="rblState_SelectedIndexChanged" RepeatDirection="Horizontal">
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td>
                        备选装备：
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlDevice" runat="server" AutoPostBack="True" Width="260" OnSelectedIndexChanged="ddlDevice_SelectedIndexChanged">
                        </asp:DropDownList>
                        &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlDevice"
                            Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
                        <asp:Label runat="server" ID="lblDetail"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        个数：
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="DeviceCount" Width="73px"></asp:TextBox><asp:Label
                            runat="server" ID="Unit"></asp:Label>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="DeviceCount"
                            ErrorMessage="*" ValidationExpression="[0-9]*"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="添加" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="prompt">
                            <asp:Label ID="Prompt" runat="server" />
                        </div>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" Caption="<span>器材列表</span>"
        DataKeyNames="DeviceID,Id" OnRowDataBound="UserGrid_RowDataBound" OnRowCommand="GridView1_RowCommand"
        OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing"
        OnRowUpdating="GridView1_RowUpdating">
        <Columns>
            <asp:TemplateField>
                <ItemStyle HorizontalAlign="Center" />
                <HeaderStyle Width="30px" />
                <ItemTemplate>
                    <asp:Label ID="ID" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="装备器材名称">
                <ItemTemplate>
                    <a href="javascript:OpenWin('../../BasicBase/DeviceView.aspx?DeviceID=<%# Eval("DeviceID") %>');">
                        <asp:Label runat="server" ID="DeviceName"></asp:Label></a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="类别">
                <ItemTemplate>
                    <asp:Label runat="server" ID="DeviceClass"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="数量">
                <ItemTemplate>
                    <%#Eval("Count") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox runat="server" ID="txtDeviceCount" Width="50" Text='<%# Eval("Count") %>'></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtDeviceCount"
                        ErrorMessage="*" ValidationExpression="[0-9]*"></asp:RegularExpressionValidator>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="状态">
                <ItemTemplate>
                    <asp:Label runat="server" ID="State"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton runat="server" ID="Edit" CommandName="Edit" CommandArgument='<%# Eval("DeviceID") %>'
                        Text="编辑" />
                    <asp:LinkButton runat="server" CommandArgument='<%# Eval("id") %>' ID="lkbDel" CommandName="Del"
                        OnClientClick="return confirm('是否真的删除?')" Text="删除"></asp:LinkButton>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:LinkButton runat="server" ID="Update" CommandName="Update">修改</asp:LinkButton>
                    <asp:LinkButton runat="server" ID="LinkButton1" CommandName="Cancel">取消</asp:LinkButton>
                </EditItemTemplate>
                <ItemStyle HorizontalAlign="Right" />
            </asp:TemplateField>
        </Columns>
        <HeaderStyle HorizontalAlign="Left" />
    </asp:GridView>
    <uc1:ListPageContral ID="ListPageContral1" PageSize="15" runat="server" OnPageSizeChange="ListPageContral1_PageSizeChange" />
</asp:Content>
